#include "CharacterIdle.h"
#include "Map.h"

CharacterIdle::CharacterIdle(void)
{
}

CharacterIdle::~CharacterIdle(void)
{
}

void CharacterIdle::Load()
{

	mSprite.Add("chicken1.png");
	mSprite.Add("chicken2.png");
	mSprite.Add("chicken3.png");
	mSprite.Add("chicken1.png");
	mSprite.Add("chicken2.png");
	mSprite.Add("chicken3.png");
	mSprite.Add("chicken1.png");
	mSprite.Add("chicken2.png");
	mSprite.Add("chicken3.png");
	mSprite.Add("chicken1.png");
}

void CharacterIdle::Unload()
{
	mSprite.Stop();
	mSprite.Reset();
	mSprite.Unload();
}

void CharacterIdle::Update(float deltaTime,const Map& map)
{
	mSprite.Update(deltaTime);
}

void CharacterIdle::Render(const SVector2& viewOffset)
{
	const int width = mSprite.GetWidth();
	const int height = mSprite.GetHeight();
	SVector2 offset(width * 0.5f, height * 0.5f);
	SVector2 renderPosition = mPosition - offset;
	mSprite.SetPosition(renderPosition);

	mSprite.Render();
}

void CharacterIdle::Play()
{
	mSprite.Play(4.0f, true);
	mSprite.Reset();
}

void CharacterIdle::Stop()
{
	mSprite.Play(4.0f, false);
	mSprite.Reset();
}
